﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace NFlickr.Helper
{
    public class Url
    {
        public static string GetUrl(string host, int port, bool isHttps, string url)
        {
            string httpPrefix = isHttps ? "https" : "http";
            string portString = string.Empty;

            if (!url.StartsWith("/"))
            {
                url = "/" + url;
            }

            if (port == 0)
            {
                return string.Format("{0}://{1}{2}", httpPrefix, host, url);
            }
            return string.Format("{0}://{1}{2}{3}", httpPrefix, host, port, url);
        }
    }
}
